﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace EdgarReporte
{
    public partial class frmNormal : Form
    {
        public frmNormal()
        {
            InitializeComponent();
        }

        //creo la propiedad que recibe el nombre de la impresora
        public String Impresora { get; set; }

        private void Form1_Load(object sender, EventArgs e)
        {


            var printSetting = new System.Drawing.Printing.PageSettings();   

            printSetting.PaperSize = new System.Drawing.Printing.PaperSize("ReportAlacran",583,827);
            printSetting.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
            //asigno el nombre de la impresora que deseo usar y listo
            printSetting.PrinterSettings.PrinterName = Impresora;             

            reportViewer1.SetPageSettings(printSetting);
                                  
            this.reportViewer1.RefreshReport();            
           

            var pp = new System.Drawing.Printing.PageSettings();
            foreach (var item in pp.PrinterSettings.PaperSizes)
            {
                listBox1.Items.Add(item.ToString());
            }

            
            var printReport = new PrintReport.ReportPrintDocument(reportViewer1.LocalReport,printSetting);
            
            printReport.Print();

            this.Close();
           
        }

        private void button1_Click(object sender, EventArgs e)
        {
            reportViewer1.PrintDialog();
        }
      
    }
}
